<!DOCTYPE html>
<html class="x-admin-sm" lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改项目经历信息</title>
    <meta content="webkit" name="renderer">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <link rel="stylesheet" th:href="@{/layui/css/font.css}">
    <link rel="stylesheet" th:href="@{/layui/css/xadmin.css}">
    <link rel="stylesheet" th:href="@{/layui/css/login.css}">
    <script charset="utf-8" th:src="@{/layui/lib/layui/layui.js}" type="text/javascript"></script>
    <script th:src="@{/layui/js/xadmin.js}" type="text/javascript"></script>
</head>
<body class="login-bg">
<div class="layui-fluid">
    <div class="layui-row" style="width: 600px;margin: 80px auto auto;">
        <form class="layui-form" enctype="multipart/form-data" id="fm" style="background: white;padding: 30px 20px;border-radius: 20px">
            <div style="display: none">
                <label>
                    <input name="id" th:value="${projectExperience.id}">
                </label>
            </div>
            <div style="display: none">
                <label>
                    <input name="resume.id" th:value="${projectExperience.resume.id}">
                </label>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="projectName">项目名称&emsp;</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="projectName" lay-verify="required" name="projectName" th:value="${projectExperience.projectName}" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="role">担任角色&emsp;</label>
                <div class="layui-input-inline">
                    <input class="layui-input" id="role" lay-verify="required" name="role" th:value="${projectExperience.role}" type="text">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" for="projectDescribe">项目描述&emsp;</label>
                <div class="layui-input-inline">
                    <textarea class="layui-input" id="projectDescribe"
                              lay-verify="required" name="projectDescribe" style="width: 440px;height: 100px">[[${projectExperience.projectDescribe}]]</textarea>
                </div>
            </div>

            <button class="layui-btn" id="L_repass" lay-filter="edit" lay-submit
                    style="width: 100%" type="submit">修改信息</button>
        </form>
    </div>
</div>

<script>
    layui.use([ 'form', 'layer', 'jquery' ], function() {
        const form = layui.form, layer = layui.layer,
            $ = layui.jquery;
        //监听提交
        form.on('submit(edit)', function(data) {
            $.ajax({
                url : "/admin_student_project_experience_message_save_or_edit",
                method : 'post',
                data : data.field,
                dataType : 'JSON',
                success : function(res) {
                    if (res.code === 0) {
                        //弹出提示，并在1秒后进行跳转
                        layer.alert("修改成功", {
                            icon : 6
                        }, function() {
                            //关闭当前frame
                            xadmin.close();

                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                            return false;
                        });
                    } else {
                        layer.msg("修改失败:" + res.msg);
                        return false;
                    }
                }
            });
            return false;
        });
    })
</script>
</body>
</html>